﻿using DualPlaneFR4Paster.Migrations;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using static System.Windows.Forms.AxHost;
using System.Windows.Controls;
using System.ComponentModel.DataAnnotations;
using HalconDotNet;

namespace DualPlaneFR4Paster.Models
{
    public class MPoint
    {
        public double X { get; set; }
        public double Y { get; set; }
        public double Z { get; set; }
        public double R { get; set; }
        public int ZIndex { get; set; }//多个Z轴的情况，指定是哪个Z轴，从0开始
        public int RIndex { get; set; }
    }
    public class XYZRPoint : MPoint
    {
        public int Id { get; set; }
        public string? Name { get; set; }
        public string? Alias { get; set; }
        public int Floor { get; set; }//多层设备，指定哪一层，从1开始
    }
    public class PastePoint : XYZRPoint
    {
        public int SuckerIndex { get; set; }//用哪个头贴
        public int FeederIndex { get; set; }//贴哪种料
        public int PcsOrder { get; set; }//贴合次序
        public double ST_X { get; set; }//特征点标准位置
        public double ST_Y { get; set; }//特征点标准位置
        public double ST_R { get; set; }//特征点标准位置
    }
    public class MParam
    {
        public int Id { get; set; }
        public string? Name { get; set; }
        public string? Type { get; set; }
        public string? Alias { get; set; }
        public string Value { get; set; }
        public string? Unit { get; set; }
        public int Floor { get; set; }
    }
    public class Feeder
    {
        public bool IsUsed { get; set; }
        public int ColumnCount { get; set; }
        public double deltaX { get; set; }
        public double deltaY { get; set; }
    }
    public class Sucker
    {
        public int FeederIndex { get; set; }
    }
    public class MPcs
    {
        [Key]
        public int Id { get; set; }//识别ID
        public bool IsUse { get; set; }//是否使用
        public int Index { get; set; }//在产品上的次序
        public double X { get; set; }//绝对坐标X
        public double Y { get; set; }//绝对坐标Y
        public double R { get; set; }//绝对坐标R
        public double Z { get; set; }//绝对坐标Z
        public double STX { get; set; }//图像识别出来的标准坐标X
        public double STY { get; set; }//图像识别出来的标准坐标Y
        public double STR { get; set; }//图像识别出来的标准坐标R
        public double Width { get; set; }//宽度
        public double Height { get; set; }//高度
        public double X1 { get; set; }//需要正面辅助的X，只有反面点位才需要
        public double Y1 { get; set; }//需要正面辅助的Y，只有反面点位才需要
        public double R1 { get; set; }//需要正面辅助的R，只有反面点位才需要
        public double Z1 { get; set; }//需要正面辅助的Z，只有反面点位才需要
        public int PickIndex { get; set; }//用哪个头贴。0,1,2,3
        public int PressIndex { get; set; }//用哪个头压。0,1,2,3，只有反面点位才需要
    }
    public class MProduct
    {
        [Key]
        public int Id { get; set; }//识别ID
        public bool IsUse { get; set; }//是否使用
        public bool IsReverse { get; set; }//产品是否反着放的→视觉加载哪套模板
        public int PcsOrder { get; set; }//上下移 排序
        public int Order { get; set; }//X方向或Y方向扫
        public int Direction { get; set; }//正方向或反方向扫→为了实现S形走法
        public double StartX { get; set; }//起点X坐标
        public double StartY { get; set; }//起点Y坐标
        public double EndX { get; set; }//终点X坐标
        public double EndY { get; set; }//终点Y坐标
        public int Floor { get; set; }//第几层
        public virtual ICollection<MPcs> Pcses { get; set; }
    }
    public class MPartNum
    {
        [Key]
        public int Id { get; set; }
        public string PartNum { get; set; }
    }
    public class MSystemParam
    {
        [Key]
        public int Id { get; set; }
        public string Name { get; set; }
        public string Value { get; set; }
    }
    public class ProductFly
    {
        public double X;
        public double Y;
        public double Length;
        public List<double> PcsList;
        public int Order;
        public int PcsOrder;
        public int Direction;
    }
    public class ImageProductFly
    {
        public HObject Image;
        public int PcsOrder;
        public int PcsIndex;
    }
    public class SuckerWork
    {
        public int FeederIndex;//用哪个卷料
        public bool IsUsed;
        public SuckerWork()
        {
            IsUsed = true;
        }
    }
    public class FeederWork
    {
        public int Counter;//计数器
        public double DeltaX;
        public double DeltaY;
        public int ColumnCount;
    }
    public class ProductionStatistic
    {
        public DateTime Time { get; set; }
        public int CurCount { get; set; }
        public long TotalCount { get; set; }
    }
    public class MPcsWork
    {
        public int PickIndex;
        public int PressIndex;
        public int PcsIndex;
        public int PcsOrder;
        public double X;//贴合点
        public double Y;
        public double R;
        public double Z;
        public double STX;
        public double STY;
        public double STR;
        public double X1;//辅助压合点
        public double Y1;
        public double R1;
        public double Z1;
        public double FilmX;//拍照后矫正点
        public double FilmY;
        public double FilmR;
        public double PcsX;//目标点
        public double PcsY;
        public double PcsR;
    }
    public struct MMarkResult
    {
        public bool Result;
        public double Row;
        public double Column;
    }
    public enum MLogType
    {
        生产,
        调试,
        报警,
        错误
    }
    public enum MessageType
    {
        Message,
        Confirm
    }
}
